<% layout('/layouts/default.html', {title: '单位评分排名', libs: ['layout', 'dataGrid']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-tools pull-left" style="position: relative">
                <ul class="nav nav-tabs bangPing-tabs">
                    <li class="active"><a href="${ctx}/exam/dcSupExamRanking/unitRankingView?examId=${dcSupExamOrgScore.examId}">${text('评分排名')}</a></li>
                    <li ><a href="${ctx}/exam/dcSupExamRanking/danRankingView?examId=${dcSupExamOrgScore.examId}">${text('单项指标排名')}</a></li>
                </ul>
            </div>
            <#form:form id="searchForm" model="${dcSupExamOrgScore}" action="${ctx}/exam/dcSupExamRanking/unitListData" method="post" class="form-inline"
            data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
            <div style="float: right">
                <#form:hidden path="examId"/>
                <div class="form-group">
                    <label class="control-label">${text('单位分类')}：</label>
                    <div class="control-inline width-160">
                        <#form:select path="groupUnit" dictType="dc_exam_unit_classification" blankOption="true" data-placeholder="请选择" class="form-control width-160" defaultValue="0"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">${text('排名')}：</label>
                    <div class="control-inline width-160">
                        <% var sortMode = [{label:'默认排名',value:'0'},{label:'市直排名',value:'1'},{label:'县区排名',value:'2'}]; %>
                        <#form:select path="sortType" items="${sortMode}" blankOption="true" data-placeholder="请选择" itemLabel="label" itemValue="value" class="form-control width-160" defaultValue="0"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">${text('单位')}：</label>
                    <div class="control-inline width-160">
                        <#form:treeselect   title="${text('单位')}" allowClear='true'
                        path="exameOrg" labelName="exameName" labelValue="${officeName!}" labelPath="taskLeaderOrgName"
                        url="${ctx}/quota/dcSupExamSumQuotaInfo/selectOrgs"
                        isReturnValue="false" allowClear="true" canSelectRoot="true" canSelectParent="true"
                        returnFullName="false" checkbox="true" chkboxType="{'Y':'','N':''}"
                        placeholder="请选择单位"/>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
                    <button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
                    <button type="button" onclick="exportFile()"  class="btn btn-primary btn-sm">${text('导出')}</button>
                </div>
            </div>
        </#form:form>
    </div>
    <div class="box-body">
        <table id="dataGrid"></table>
    </div>
</div>
</div>
<% } %>
<script>
    //重置
    function cz(){
        searchForm.reset();
        $('#dataGrid').dataGrid('reloadGrid');
    }

    $('#dataGrid').dataGrid({
        searchForm: $("#searchForm"),
        sortableColumn: false, // 列表不允许排序
        showRownum: false,
        columnModel: [
            {header:'${text("主键")}',hidden: true, name:'id', index:'a.id', width:150, align:"left", frozen:true},
            {header:'${text("单位分类")}', name:'groupUnit', width:100, align:"left",formatter: function(val, obj, row, act){
                    return js.getDictLabel(${@DictUtils.getDictListJson('dc_exam_unit_classification')}, val, '', true);}},
            {header:'${text("被考核单位")}',sortable:false, name:'exameName', width:100, align:"left"},
            {header:'${text("总得分")}',sortable:false, name:'myScore',width:50, align:"center"},
            {header:'${text("排名")}',sortable:false, name:'ranking', width:50, align:"center"},
        ],
        onSelectRow: function(id, isSelect, event){

        },
        ajaxSuccess: function(data){

        }
    });

    function exportFile(){
        window.open("${ctx}/exam/dcSupExamRanking/exportSortFile?examId="+$("#examId").val())
    }

</script>

<script>

    $('#groupUnit').on('select2:select', function (evt) {
        // Do something
       $("#sortType").val('').trigger("change");
    });
    $("#sortType").on('select2:select',()=>{
        $('#groupUnit').val('').trigger("change");
    })
</script>